export default function (map) {
  let view = new mapvgl.View({
    map: map,
  });

  return {
    addLineRainbowLayer(points) {
      let lineLayer = new mapvgl.LineRainbowLayer({
        style: "road", // road, arrow, normal
        width: 5,
        color: [
          "#f00",
          "#f0f",
          "#0af",
          "#0a0",
          "#F09",
          "#a09",
          "#ff0",
          "#fd0",
          "#f90",
          "#f00",
        ],
      });
      view.addLayer(lineLayer);

      var data = [
        {
          geometry: {
            type: "LineString",
            coordinates: points,
          },
        },
      ];
      lineLayer.setData(data);
    },
  };
}
